//
//  SpotLabelCell.m
//  hai游～
//
//  Created by jakf_17 on 15/5/23.
//  Copyright (c) 2015年 jakf_17. All rights reserved.
//

#import "SpotLabelCell.h"

@implementation SpotLabelCell

- (void)dealloc
{
    [_contentLabel release];
    [_titileLabel release];
    [_buttomView release];
    
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createMyLabel];
    }
    return self;
}
- (void)createMyLabel
{
    self.titileLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, [[UIScreen mainScreen] bounds].size.width, 25)];
//    _titileLabel.textAlignment = NSTextAlignmentCenter;
    _titileLabel.font = [UIFont boldSystemFontOfSize:17];
    [self addSubview:_titileLabel];
    [_titileLabel release];
    
    self.contentLabel = [[UILabel alloc] initWithFrame:CGRectZero];
    _contentLabel.numberOfLines = 0;
    _contentLabel.textColor = [UIColor blackColor];
    _contentLabel.font = [UIFont systemFontOfSize:13];
    [self addSubview:_contentLabel];
    [_contentLabel release];
    
    self.buttomView = [[UIView alloc] initWithFrame:CGRectZero];
    [self addSubview:_buttomView];
    [_buttomView release];
    _buttomView.backgroundColor = [UIColor colorWithRed:220 / 255.0 green:220 / 255.0 blue:220 / 255.0 alpha:1];
}
- (void)layoutSubviews
{
    NSString *str = _contentLabel.text;
    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:13]};
    CGRect rect = [str boundingRectWithSize:CGSizeMake([[UIScreen mainScreen] bounds].size.width - 14, 10000) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    _contentLabel.frame = CGRectMake(7, 30, rect.size.width, rect.size.height);
    _buttomView.frame = CGRectMake(3, self.frame.size.height , [[UIScreen mainScreen] bounds].size.width - 6, 0.5);
    
    [super layoutSubviews];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
